{extend name="public/base"/}
{block name="body"}
<style>
.mui-table-view-cell p {
    margin-bottom: 0;
    font-size: 12px;
}
.mui-table-view .mui-media-object {
    line-height: 42px;
    width: 60px !important;
        max-width: 60px;
    height: 60px;
}
.mui-card-header {
    font-size: 12px;
    border-radius: 2px 2px 0 0;
        padding: 5px 10px;
}
</style>
<header class="mui-bar mui-bar-nav">
  <a class=" mui-icon mui-icon-left-nav mui-pull-left" href="{:url('index/index/qiye', ['cid'=>cookie('company_id')])}"></a>
  <h1 class="mui-title">我的订单</h1>
</header>
<div class="mui-content" style="    margin-bottom: 100px;">
  {volist name="list" id="vo"}
    <div class="mui-card">
      	<div class="mui-card-header ">
          <div class="mui-ellipsis mui-col-xs-8">订单编号：{$vo['out_trade_no']}</div>
            <div class="mui-col-xs-4 mui-text-right"><button type="button" class="mui-btn mui-btn-primary mui-btn-outlined" style="font-size:12px;">{$vo['buystatus']|parse_config_value='pay_status'}</button></div>
        </div>
      	<div class="mui-card-content">
      		<div class="mui-card-content-inner" style="    padding: 5px 0;">

            <ul class="mui-table-view mui-table-view-chevron">
                <li class="mui-table-view-cell mui-media" onclick='window.location.href = "{:url('index/order/detail',array('id'=>$vo['id']))}"'>
                    <a class="mui-navigate-right">
                        <img class="mui-media-object mui-pull-left" src="{$vo['cover_id']|get_cover='path'}">
                        <div class="mui-media-body" style="    overflow: initial;">
                            <p><span style='color:red'>¥{$vo['total']}</span></p>
                            <p >下单时间：{$vo['create_time']}</p>
                            <p>收货时间：{$vo['deliverytime']}</p>
                        </div>
                    </a>
                </li>

            </ul>
            {switch name="vo.buystatus"}
                {case value="0"}
                  <div class=" mui-text-right" style="padding-right:15px;">
                    <button type="button" onclick='window.location.href = "{:url('index/order/qiyepay',array('id'=>$vo['id']))}"' class="mui-btn mui-btn-warning" style="font-size:12px;">去付款</button>
                                        <button type="button" data-id="{$vo['id']}" class="mui-btn mui-btn delorder" style="font-size:12px;">删除</button>
                  </div>

                {/case}


            {/switch}

        	</div>
      </div>
    </div>
  {/volist}

</div>

{/block}
{block name="script"}
<script>
  mui.init({
    swipeBack:true //启用右滑关闭功能
  });
  $('#scroll').height($(window).height()-44)


  $(function(){
    $('.delorder').on('click', function(){
      var $this = $(this),id = $this.attr('data-id')
      var btnArray = ['否', '是'];
      mui.confirm('您确定要删除该订单吗？', '删除订单', btnArray, function(e) {
        if (e.index == 1) {
            $.post("{:url('index/order/delorder')}", {
                "id": id
            }, function(data) {
                mui.toast('删除成功！')
                setTimeout(function() {
                  location.reload()
                }, 2000);
            }, "json");

        } else {
          return ;
        }
      })


    })
  })


</script>
{/block}
